﻿using DearlerPlatform.Domain;
using DearlerPlatfrom.Core.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DearlerPlatfrom.Service.CustomerApp
{
    public partial class CustomerService : ICustomerService
    {
        private readonly IRepository<Customer> _customerRepo; //客户表
        private readonly IRepository<CustomerInvoice> _customerInvoiceRepo; //客户凭据
        private readonly IRepository<CustomerPwd> _customerPwdRepo; //用户密码

        public CustomerService(
            IRepository<Customer> customerRepo,
            IRepository<CustomerInvoice> customerInvoiceRepo,
            IRepository<CustomerPwd> customerPwdRepo
            )
        {
            _customerRepo = customerRepo;
            _customerInvoiceRepo = customerInvoiceRepo;
            _customerPwdRepo = customerPwdRepo;
        }

        /// <summary>
        /// 用户编号获取真实数据
        /// </summary>
        /// <param name="customerNo"></param>
        /// <returns></returns>
        public async Task<Customer> GetCustomerAsync(string customerNo)
        {
            return await _customerRepo.GetAsync(m => m.CustomerNo == customerNo);
        }
    }
}
